﻿import './utils/rxjs-extensition'
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { LoginComponent } from './components/login/login.component';
import { FormComponent } from './components/form/form.component';
import { MoviesComponent } from './components/movies/movies.component';
import { PageComponent } from './components/page/page.component';
import { HttpModule } from '@angular/http';
import { RouterModule, Routes } from '@angular/router';
import { MyRatingDirective } from './directive/rating/rating.directive';
import { MyChartDirective } from './directive/chart/chart.directive';
import { AvailableMovieComponent } from './components/movies/availableMovie.component';
import { SideBarComponent } from './components/layout/sideBar.component';
import { TopBarComponent } from './components/layout/topbar.component';
import { ApiService } from './services/app.service.api';
import { AppServiceMembership } from './services/app.service.membership';
import { RegisterCustomerComponent } from './components/customers/registercustomer.component';
import { AppServiceAuthGuard } from './services/app.service.auth-guard';
import { HomeComponent } from './components/home/home.component';
import { CustomerComponent } from './components/customers/customer.component';
import { AddMovieComponent } from './components/movies/addmovie.component';


const appRoutes: Routes = [
    { path: '', redirectTo: '/home', pathMatch:'full' },
    { path: 'home', component: HomeComponent },
    { path: 'customers', component: CustomerComponent },
    { path: 'login', component: LoginComponent },
    { path: 'movies', component: MoviesComponent },
    { path: 'movies/add', component: AddMovieComponent },
    { path: 'customers/register', component: RegisterCustomerComponent, canActivate: [AppServiceAuthGuard] }
   
    //{
    //    path: 'heroes',
    //    component: HeroListComponent,
    //    data: {
    //        title: 'Heroes List'
    //    }
    //},
    //{ path: '', component: HomeComponent },
    //{ path: '**', component: PageNotFoundComponent }
];

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        ReactiveFormsModule,
        HttpModule,
        RouterModule.forRoot(appRoutes),
    ],
    declarations: [
        AppComponent,
        LoginComponent,
        FormComponent,
        MoviesComponent,
        PageComponent,
        MyRatingDirective,
        AvailableMovieComponent,
        SideBarComponent,
        TopBarComponent,
        RegisterCustomerComponent,
        HomeComponent,
        MyChartDirective,
        CustomerComponent,
        AddMovieComponent
    ],
    providers: [
        ApiService,
        AppServiceMembership,
        AppServiceAuthGuard
    ],
    bootstrap: [AppComponent]
})
export class AppModule { }
